home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / tad.arc / TAD.ASM next >
Assembly Source File  |  1984-02-09  |  2KB  |  74 lines

  1. page    55,80
  2. title    TAD:  Time and date program for the PC/AT
  3. ;
  4. ;This program provides a DOS command to set the time and date into the
  5. ;BIOS real-time clock.  The BIOS routine also sets the CMOS memory.
  6. ;Program has no effect on anything other than DOS 3.0 and PC/AT
  7. TERMINATE    equ    4CH    ;terminate program execution
  8. GETDATE        equ    2AH    ;read DOS date
  9. GETTIME        equ    2CH    ;read DOS time
  10. RTC        equ    1AH    ;access real-time clock
  11.   WTIME        equ    03H    ;  write the clock and CMOS
  12.   WDATE        equ    05h    ;  write the date and CMOS
  13. ;----------------------------------------------------------
  14. DOS    macro    fcn_code
  15.     mov    ah,fcn_code
  16.     int    21H
  17.     endm
  18. ;--------------------------
  19. BIOS    macro    int_no,fcn_code
  20.     mov    ah,fcn_code
  21.     int    int_no
  22.     endm
  23. ;--------------------------
  24. B2BCD    macro    register
  25.     mov    al,register
  26.     call    B2_BCD
  27.     mov    register,al
  28.     endm
  29. ;--------------------------
  30. ;Set so EX2BIN can convert program to COM format
  31. CSEG    segment    para public 'CODE'
  32.     assume    cs:CSEG, ds:CSEG
  33. ;
  34.     org    100h
  35. START:    jmp    GO    ;jump around data
  36. ;----------------------------------------
  37. BY10    db    10
  38. BY100    db    100
  39. ;----------------------------------------
  40. MAIN    proc    far
  41. GO:    DOS    GETDATE
  42.     mov    ax,cx
  43.     div    BY100
  44.     xchg    ah,al
  45.     mov    cx,ax
  46.     B2BCD    ch
  47.     B2BCD    cl
  48.     B2BCD    dh
  49.     B2BCD    dl
  50.     BIOS    RTC,WDATE
  51.     DOS    GETTIME
  52.     B2BCD    ch
  53.     B2BCD    cl
  54.     B2BCD    dh
  55.     mov    dl,0
  56.     BIOS    RTC,WTIME
  57. EXIT:    xor    al,al
  58.     DOS    TERMINATE
  59. MAIN    endp
  60. ;------------------------------------
  61. B2_BCD    proc    near
  62.     cbw
  63.     div    BY10
  64.     shl    al,1
  65.     shl    al,1
  66.     shl    al,1
  67.     shl    al,1
  68.     or    al,ah
  69.     ret
  70. B2_BCD    endp
  71. ;-----------------------------------
  72. CSEG    ends
  73.     end    START
  74.